<template>
	<view class="my">

		<view class="msg">
			<view class="">
				<image class="hp" src="http://imcdn.shimaruanchuang.cn/chat/1707989092855aW70IeavYhlBb437a43394fffa902af1a09ef3649a40.png"></image>
				<view class="username">
					{{userInfo.nickName}}
				</view>
				<view class="isVip">
					等级 {{userLevel}}
				</view>
			</view>
		</view>

		<view class="ID">
			<view class="id">
				ID :
			</view>
			<view class="userid">
				{{historyUserInfo.id}}
			</view>
		</view>
		<view class="content">
			<view class="history" @click="goHistory">
				浏览历史
			</view>
			<view class="collect" @click="goCollect">
				我的收藏
			</view>
			<view class="uploadingText" @click="goUploading">
				上传音频
			</view>
			
		</view>
	</view>
</template>

<script>
	import {
		findHistory,
		login,
		selectOne
	} from "../../config/api.js"
		import {
			baseUrl
		} from '../../config/requertUrl.js';
	export default {
		data() {
			return {
				userName: "用户名",
				idContent: "用户id",
				styles: {
					color: '#111111',
					borderColor: '#666666',
				},
				historyUserInfo: {},
				userInfo:{},
				userLevel: 0 
				
			};
		},
		onLoad() {


		},
		onShow() {
			this.history();
			console.log("this.historyUserInfo:", this.historyUserInfo);
			this.selectOneFun();
			this.getUserInfo();
		},

		methods: {
			selectOneFun(){
				let that = this
				let param = {
					id : that.historyUserInfo.id
				}
				selectOne({
					custom: {
						auth: true,
						loading: false
					},
					params: param
				}).then((res) => {
					that.userInfo = res.data
				}).catch((e) => {})
			},
			goUploading(){
				uni.navigateTo({
					url:"/pages/uploading/uploading"
				})
			},
			onImg1(e) {
				console.log("准备上了");
				uni.chooseImage({
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						console.log(tempFilePaths);
						uni.uploadFile({
							url: baseUrl+'/auth/common/upload', //仅为示例，非真实的接口地址
							filePath: tempFilePaths[0],
							name: 'file',
							success: (tempFilePaths) => {
								console.log(tempFilePaths.data);
							},fail(e) {
								console.log(e);
							}
						});
					}
				});

			},	
			goHistory(e) {
				uni.navigateTo({
					url: "/pages/history/history"
				})
			},
			goCollect(e) {
				uni.navigateTo({
					url: "/pages/collect/collect"
				})
			},
			history() {
				this.historyUserInfo = uni.getStorageSync("userInfo")
			},
			getUserInfo() {
				let that = this
				let param = {
					id: that.historyUserInfo.id
				}
				selectOne({
					custom: {
						auth: true,
						loading: false
					},
					params: param
				}).then((res) => {
					that.userInfo = res.data
					if(that.userInfo.levelSet==null){
						that.userLevel="0"
					}else{
					that.userLevel=that.userInfo.levelSet.level	
					}
					 console.log("that.userLevel",that.userLevel);
					console.log(that.userInfo);
				}).catch((e) => {})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #222222;
	}

	.msg {
		width: 750rpx;
		height: 60rpx;

		.hp {
			width: 46rpx;
			height: 45rpx;
			padding-left: 60rpx;
			display: inline-flex;
			color: #d3dcdc;
		}

		.username {
			display: inline-flex;
			font-size: 46rpx;
			color: #d3dcdc;
			padding-left: 50rpx;
		}

		.isVip {
			display: inline-flex;
			font-size: 46rpx;
			color: #d3dcdc;
			padding-left: 270rpx;
		}
	}

	.ID {
		height: 60rpx;
		width: 100%;
		padding-left: 60rpx;
		display: inline-flex;
		background: #444444;

		.id {
			display: inline-flex;
			font-size: 40rpx;
			color: #d3dcdc;

		}

		.userid {
			display: inline-flex;
			font-size: 40rpx;
			color: #d3dcdc;
			padding-left: 30rpx;
		}
	}

	.content {
		font-size: 30rpx;
		padding-left: 60rpx;
		padding-top: 30rpx;
		color: #d3dcdc;
		letter-spacing: 2rpx;

		.collect {
			padding-top: 25rpx;
		}

		.uploading {
			padding-top: 25rpx;
		}

		.uploadingText {
			padding-top: 25rpx;
		}

	}
</style>